import pygame
from init_map import InitMap


class Map(InitMap):
    def __init__(self, *args):
        InitMap.__init__(self)

        self.door_blue = pygame.image.load("../资源/图片/蓝门.png").convert_alpha()
        self.door_red = pygame.image.load("../资源/图片/红门.jpg").convert_alpha()
        self.door_iron = pygame.image.load("../资源/图片/铁门.png").convert_alpha()
        self.big_coin = pygame.image.load("../资源/图片/大金币.png").convert_alpha()
        self.little_feather = pygame.image.load("../资源/图片/小飞羽.png").convert_alpha()
        self.hot = pygame.image.load("../资源/图片/炎之灵杖.png").convert_alpha()
        self.hp_blue = pygame.image.load("../资源/图片/蓝药.jpg").convert_alpha()
        self.gem_red = pygame.image.load("../资源/图片/红宝石.jpg").convert_alpha()
        self.ling_warrior = pygame.image.load("../资源/图片/灵武士.png").convert_alpha()
        self.ling_master = pygame.image.load("../资源/图片/灵法师.png").convert_alpha()
        self.dark_prince = pygame.image.load("../资源/图片/冥灵魔王.png").convert_alpha()

        self.hero_pos = (9, 5)
        self.down_pos = (10, 5)
        self.variable_pos = {
            (8, 4): (self.big_coin, '大金币'),
            (7, 5): (self.big_coin, '大金币'),
            (8, 6): (self.big_coin, '大金币'),
            (3, 3): (self.little_feather, '小飞羽'),
            (3, 7): (self.little_feather, '小飞羽'),
            (4, 5): (self.hot, '炎之灵杖'),
            (10, 0): (self.hp_blue, '蓝药'),
            (10, 10): (self.hp_blue, '蓝药'),
            (3, 0): (self.gem_red, '红宝石'),
            (4, 0): (self.gem_red, '红宝石'),
            (5, 0): (self.gem_red, '红宝石'),
            (0, 2): (self.gem_red, '红宝石'),
            (0, 3): (self.gem_red, '红宝石'),
            (3, 10): (self.gem_red, '红宝石'),
            (4, 10): (self.gem_red, '红宝石'),
            (5, 10): (self.gem_red, '红宝石'),
            (0, 8): (self.gem_red, '红宝石'),
            (0, 7): (self.gem_red, '红宝石'),
            (8, 1): (self.door_blue, '蓝门'),
            (8, 5): (self.door_blue, '蓝门'),
            (8, 9): (self.door_blue, '蓝门'),
            (1, 5): (self.door_red, '红门'),
            (3, 5): (self.door_iron, '铁门'),
            (0, 0): (self.ling_warrior, '灵武士_sss'),
            (0, 10): (self.ling_warrior, '灵武士_sss'),
            (4, 2): (self.ling_warrior, '灵武士_sss'),
            (5, 2): (self.ling_warrior, '灵武士_sss'),
            (6, 2): (self.ling_warrior, '灵武士_sss'),
            (4, 8): (self.ling_warrior, '灵武士_sss'),
            (5, 8): (self.ling_warrior, '灵武士_sss'),
            (6, 8): (self.ling_warrior, '灵武士_sss'),
            (1, 4): (self.ling_master, '灵法师_sss'),
            (1, 6): (self.ling_master, '灵法师_sss'),
            (3, 2): (self.ling_master, '灵法师_sss'),
            (3, 8): (self.ling_master, '灵法师_sss'),
            (2, 5): (self.dark_prince, '冥灵魔王_sss'),
        }

    def fixed_brick(self):
        self.draw(self.downstairs, self.down_pos[0], self.down_pos[1])
        self.dic[self.down_pos] = '下22楼'
        for j in range(10):
            if j != 5:
                self.draw(self.wall, 10, j)
                self.dic[(10, j)] = '墙'
        for i in range(6):
            self.draw(self.wall, i + 1, 1)
            self.dic[(i + 1, 1)] = '墙'
            self.draw(self.wall, i + 1, 9)
            self.dic[(i + 1, 9)] = '墙'
            self.draw(self.wall, i + 2, 4)
            self.dic[(i + 2, 4)] = '墙'
            self.draw(self.wall, i + 2, 6)
            self.dic[(i + 2, 6)] = '墙'
        for i in range(8):
            if i != 2:
                self.draw(self.wall, i + 1, 3)
                self.dic[(i + 1, 3)] = '墙'
                self.draw(self.wall, i + 1, 7)
                self.dic[(i + 1, 7)] = '墙'
        for i in [(0, 5), (8, 0), (8, 10), (5, 5), (6, 5), (1, 2), (2, 2), (8, 2), (1, 8), (2, 8), (8, 8)]:
            self.draw(self.wall, i[0], i[1])
            self.dic[(i[0], i[1])] = '墙'

        for i in self.ls:
            self.screen.blit(self.road, i)
            self.dic[(int((i[0]-375)/48), int((i[1]-25)/48))] = '路'
